package com.wnhoo.smartfishtank.util;

import java.util.Random;
import java.util.UUID;

/**
 * Created by ThinkPadE431 on 2015/4/27.
 */
public class MyUUID {

    /**
     * 32 位去掉"-"
     * @return
     */
    public static String getUUID(){

        return UUID.randomUUID().toString().replace("-", "").toUpperCase();
    }

    public static String getUUID8Bit() {
        return getUUID().substring(0,8);
    }


    public static String random6bit() {
        int count = 6;
        char start = '0';
        char end = '9';

        Random rnd = new Random();

        char[] result = new char[count];
        int len = end - start + 1;

        while (count-- > 0) {
            result[count] = (char) (rnd.nextInt(len) + start);
        }

        return new String(result);
    }
    }
